from PIL import Image
import cairosvg
import os

def convert_svg_to_png(svg_path, png_path, size):
    # 将SVG转换为PNG
    cairosvg.svg2png(url=svg_path, write_to=png_path, output_width=size, output_height=size)

def main():
    # 创建icons目录（如果不存在）
    if not os.path.exists('icons'):
        os.makedirs('icons')
    
    # 定义需要转换的尺寸
    sizes = [16, 48, 128]
    
    # 转换SVG为不同尺寸的PNG
    for size in sizes:
        output_path = f'icons/icon{size}.png'
        convert_svg_to_png('icons/icon.svg', output_path, size)
        print(f'Created {output_path}')

if __name__ == '__main__':
    main() 